﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OOSE_TDD
{
    public class Customer : IEquatable<Customer>
    {
        #region fields
        private string firstName = "";
        private string lastName = "";
        private string birthday = "";
        private string street = "";
        private string postCode = "";
        private string city = "";
        private string country = "";
        private string mailAdress = "";
        #endregion

        #region properties
        public string FirstName
        {
            get { return firstName; }
            set { firstName = value; }
        }

        public string LastName
        {
            get { return lastName; }
            set { lastName = value; }
        }

        public string Birthday
        {
            get { return birthday; }
            set { birthday = value; }
        }

        public string Street
        {
            get { return street; }
            set { street = value; }
        }

        public string PostCode
        {
            get { return postCode; }
            set { postCode = value; }
        }

        public string City
        {
            get { return city; }
            set { city = value; }
        }

        public string Country
        {
            get { return country; }
            set { country = value; }
        }

        public string MailAdress
        {
            get { return mailAdress; }
            set { mailAdress = value; }
        }
        #endregion

        public Customer()
        {

        }

        public Customer(string firstName, string lastName, string birthday, string street,
                            string postCode, string city, string country, string mailAdress)
        {
            this.firstName = firstName;
            this.lastName = lastName;
            this.birthday = birthday;
            this.street = street;
            this.postCode = postCode;
            this.city = city;
            this.country = country;
            this.mailAdress = mailAdress;
        }

        public override bool Equals(Object obj)
        {
            if (obj == null) return base.Equals(obj);

            if (!(obj is Customer))
                throw new InvalidCastException("The 'obj' argument is not a Customer object.");
            else
                return Equals(obj as Customer);
        }

        public bool Equals(Customer other)
        {
            if (this.birthday == other.birthday
                && (this.city == other.city)
                && (this.country == other.country)
                && (this.firstName == other.firstName)
                 && (this.lastName == other.lastName)
                 && (this.mailAdress == other.mailAdress)
                && (this.postCode == other.postCode)
                && (this.street == other.street))
                return true;
            else
                return false;
        }
    }
}
